<?php
class Pageley_Basic_Command_Delete extends Pageley_Controller_Command_TransactionalReadWrite {

	private $id;
	private $typeName;

	public function setId($id) {
		$this->id = $id;
	}

	public function setTypeName($typeName) {
		$this->typeName = $typeName;
	}

	protected function executeInternal() {
		$unitOfWork = $this->getUnitOfWork();
        $factory = Pageley_Config::getInstance();
		$type = $factory->valueOf("type." . $this->typeName);
        $entity = $unitOfWork->find($type, $this->id);
        $unitOfWork->unregister($entity);
		return new Pageley_Controller_ModelAndView();
	}
}